package cn.szv5.register.client;

/**
 * 应用模块名称<p> 代码描述<p> Copyright: Copyright (C) 2022 , Inc. All rights reserved. <p> Company: 阿飞工作室<p>
 *
 * @author Carl
 * @since 2022/2/7 18:44
 */
public class RegisterWorker extends Thread {
    public static final String SERVICE_NAME = "inventory-service";
    public static final String IP = "192.168.31.207";
    public static final String HOSTNAME = "inventory01";
    public static final int PORT = 9000;

    private HttpSender httpSender;

    public RegisterWorker() {
        this.httpSender = new HttpSender();
    }

    @Override
    public void run() {
        RegisterRequest request = new RegisterRequest();
        request.setServiceName(SERVICE_NAME);
        request.setIp(IP);
        request.setHostname(HOSTNAME);
        request.setPort(PORT);

        RegisterResponse response = httpSender.register(request);
        System.out.println("服务注册的结果是：" + response.getStatus());

    }
}
